<?php
class loginPage {
	
	public function displayLoginForm($action) {
		switch($action){
		case 'forbid' :
			echo '<h3 id="errorLogin"> You have to be logged in to access this page, please log in.</h3>';
			break;
		case 'fail' :
			echo '<h3 id="errorLogin"> Wrong login or password.</h3>';
			break;
		}
		echo '<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
				<tr>
					<form name="loginForm" method="post" action="checkLogin.php">
						<td>
							<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
								<tr>
									<td colspan="3"><strong>Login</strong></td>
								</tr>
								<tr>
									<td width="78">Username</td>
									<td width="6">:</td>
									<td width="294"><input name="username" type="text" id="username" required="required"></td>
								</tr>
								<tr>
									<td>Password</td>
									<td>:</td>
									<td><input name="password" type="password" id="password" required="required"></td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
									<td><input type="submit" name="Submit" value="Login"><a href="index.php?page=signup">Sign Up</a></td>
								</tr>
							</table>
						</td>
					</form>
				</tr>
			</table>';
	}

	public function displaySignUpForm($action){
		switch($action){
			case "fail":
				echo '<h3 id="errorSignUp"> There was a problem with the database, please try to sign up again.</h3>';
				break;
			case "name" :
				echo '<h3 id="errorSignUp"> This username is already taken, please use another one</h3>';
				break;
			case 'pass':
				echo '<h3 id="errorSignUp"> You mistyped the password check, please try again.</h3>';
				break;
			
		}
		echo '<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
				<tr>
					<form name="signUpForm" method="post" action="checkSignUp.php">
						<td>
							<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
								<tr>
									<td colspan="3"><strong>Sign Up</strong></td>
								</tr>
								<tr>
									<td width="78">Username</td>
									<td width="6">:</td>
									<td width="294"><input name="newusername" type="text" id="newusername" required="required"></td>
								</tr>
								<tr>
									<td>Password</td>
									<td>:</td>
									<td><input name="newpassword" type="password" id="newpassword" required="required"></td>
								</tr>
								<tr>
									<td>Check Password</td>
									<td>:</td>
									<td><input name="checkpassword" type="password" id="checkpassword" required="required"></td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
									<td><input type="submit" name="Submit" value="Sign Up"></td>
									
								</tr>
							</table>
						</td>
					</form>
				</tr>
			</table>';
	}
}
?>